import 'package:android_studio_f/generated/json/base/json_convert_content.dart';
import 'package:android_studio_f/generated/json/base/credential_list_item_entity.dart';

CredentialListItemEntity $CredentialListItemEntityFromJson(
    Map<String, dynamic> json) {
  final CredentialListItemEntity credentialListItemEntity = CredentialListItemEntity();
  final String? corporateName = jsonConvert.convert<String>(
      json['corporateName']);
  if (corporateName != null) {
    credentialListItemEntity.corporateName = corporateName;
  }
  final int? duration = jsonConvert.convert<int>(json['duration']);
  if (duration != null) {
    credentialListItemEntity.duration = duration;
  }
  final String? durationUnit = jsonConvert.convert<String>(
      json['durationUnit']);
  if (durationUnit != null) {
    credentialListItemEntity.durationUnit = durationUnit;
  }
  final List<dynamic>? drives = (json['drives'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (drives != null) {
    credentialListItemEntity.drives = drives;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    credentialListItemEntity.id = id;
  }
  final String? createAt = jsonConvert.convert<String>(json['createAt']);
  if (createAt != null) {
    credentialListItemEntity.createAt = createAt;
  }
  return credentialListItemEntity;
}

Map<String, dynamic> $CredentialListItemEntityToJson(
    CredentialListItemEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['corporateName'] = entity.corporateName;
  data['duration'] = entity.duration;
  data['durationUnit'] = entity.durationUnit;
  data['drives'] = entity.drives;
  data['id'] = entity.id;
  data['createAt'] = entity.createAt;
  return data;
}

extension CredentialListItemEntityExtension on CredentialListItemEntity {
  CredentialListItemEntity copyWith({
    String? corporateName,
    int? duration,
    String? durationUnit,
    List<dynamic>? drives,
    int? id,
    String? createAt,
  }) {
    return CredentialListItemEntity()
      ..corporateName = corporateName ?? this.corporateName
      ..duration = duration ?? this.duration
      ..durationUnit = durationUnit ?? this.durationUnit
      ..drives = drives ?? this.drives
      ..id = id ?? this.id
      ..createAt = createAt ?? this.createAt;
  }
}